#ifndef TXTREADER_H
#define TXTREADER_H

#include <FileReader/BaseReader.h>

class TxtReader: public BaseReader {
public:
    TxtReader() {}

    virtual string getContent(const char *filename) {
        FILE   *_file;
        string _content;
        char   _buffer[5120];
        size_t _readbytes;

        _file = fopen(filename, "rb");
        if (_file == NULL) {
            throw 1;
        }

        do {
            _readbytes = fread(_buffer, 1, 5120, _file);
            if (_readbytes != 5120) {
                _buffer[_readbytes + 1] = 0;
            }

            _content += _buffer;
        } while (_readbytes == 5120);

        fclose(_file);

        return _content;
    }

protected:

};

#endif // TXTREADER_H
